<?php

namespace App\Models\CarModels;

use Illuminate\Database\Eloquent\Model;
class CarInsuranceRecord extends Model
{
    //
    protected $table = 'car_insurance_records';
    protected $fillable = ['amount','rate','kind','target','order','company','buy_date','end_date','start_date','car_id','record_id'];

    public function car(){
        return $this->belongsTo(CarInfo::class,'car_id','id')->with(['kind','department','area']);
    }

    public function record(){
        return $this->belongsTo(CarYearCheckRecord::class,'record_id','id');
    }

    public function bill()
    {
        return $this->hasMany(CarInsuranceRecordBill::class,'record_id')->with('images');
    }
    public function kind(){
        return $this->hasMany(CarInsuranceRecordsKind::class,'record_id');
    }
}
